<?php 
header("Content-type: text/html; charset=utf-8");
function M($oldPath,$newPath){
	$preg = "/\/$/";
	$newPath = preg_replace($preg, '', $newPath);
	$oldPath = preg_replace($preg, '', $oldPath);
	$newSons = glob($newPath.'/*');
	$oldSons = glob($oldPath.'/*');

	if(empty($oldSons)){
		return "没有可要移动的文件";
	}else{
	    foreach ($oldSons as $key => $value) {

	    	if(!is_dir($value)){
	    		copy($value, $newSons);
	    	}else{
	    		$newSonsNext = $newSons.mkdir($value);
	    		var_dump($newSonsNext);
	    		$newSonsNext = $value;
	    		M($value,$newSonsNext);
	    	}
	    	rmdir($oldSons);	
	    }

	}

}
M("D:/old1/","E:/new1/")
// var_dump(M("D:/new/","E:/Qiyi/"));


  






 ?>